ig.module(
	'game.entities.base.baseButton'
)
.requires(
	'impact.image',
        'game.entities.base.entityBase'   
)

.defines(function()
{
    EntityBaseButton = EntityEntityBase.extend(
    {    
        size: {x:107, y:38},
	
	collides: ig.Entity.COLLIDES.PASSIVE,
        zIndex: 100,
	selected: false,
        selectable: false,
	canHover: true,
	toBeDrawed: true,
	
        normalButton: new ig.Image("media/images/start.png"),
        overButton: new ig.Image("media/images/startOver.png"),

        init: function(x, y, settings)
        {
	    this.parent(x, y, settings);
        },
        
        draw: function()
        {
            this.parent();
            
	    if (this.toBeDrawed == true)
	    {
		if (this.wasClicked() == true)
		{
		    this.onClick();
		}            
		
    
		if (this.selected == true && this.selectable == true)
		{
		    this.selectedButton.draw(this.pos.x, this.pos.y);	    
		}
		else if (this.isMouseOver() && this.canHover == true)
		{
		    this.overButton.draw(this.pos.x, this.pos.y);
		}
		else
		{
		    this.normalButton.draw(this.pos.x, this.pos.y);                
		}
	    }
        },
        
        onClick: function()
        {
	    if (this.selectable == true && this.selected == false)
	    {
		this.selected = true;
		
		this.onSelect();
	    }
        },
	
	onSelect: function()
	{
	    
	}
    });
});